import isValidKey from "./isValidKey";
export function getInterfaceRoute(name: string) {
  if(isValidKey(name, interfaceRoute)) {
    return interfaceRoute[name];
  }
  else {
    throw console.error();
  }
}

const URL = {
  develop: 'https://shenhailao.com/sign-in-management-system-back-test',
  product: 'https://shenhailao.com/sign-in-management-system-back',
  local: 'http://127.0.0.1/csm',
  local2: 'http://127.0.0.1/sign-in-management-system-back',
}
export const url = URL.product;
// 开发环境
const ENV = url + '/index.php?r=';
// 选择环境
const DOMAIN = ENV;
//接口地址
const interfaceRoute = {
  init:DOMAIN+"user/WxInit",
  GetCourse:DOMAIN +'user/GetCourse',
  curriculumInit:DOMAIN +'user/CurriculumInit',
  Login:DOMAIN+'user/WxLogin',
  BindAdmin:DOMAIN+'user/BindWxAdmin',
  getGradeClasses:DOMAIN+'user/GetClasses',
  updateUserInfo:DOMAIN+'user/update',
  updateAdminInfo:DOMAIN+'user/updateAdmin',
  GetActivity:DOMAIN+'activity/GetActivity',
  GetActivityDetail:DOMAIN+"activity/GetDetail",
  GetGradeActivity:DOMAIN+'activity/GetGradeActivity',
  activityExportJoin:DOMAIN+'activity/ExportJoin',
  activityExportSign:DOMAIN+'activity/ExportSign',
  addActivity:DOMAIN+'activity/Add',
  JoinActivity:DOMAIN+'activityJoin/JoinActivity',
  CancelJoin:DOMAIN+'activityJoin/CancelJoin',
  GetJoinData:DOMAIN+'activityJoin/GetJoinData',
  GetJoinAccount:DOMAIN+'activityJoin/GetJoinAccount',
  GetStudentData:DOMAIN+'activityJoin/GetStudentData',
  GetSignDetail:DOMAIN+'sign/WxGetSignDetail',
  SignIn:DOMAIN+'sign/WxSign',
  uploadJoin:DOMAIN+'activityStudents/uploadJoin',
  upload:DOMAIN+'activityStudents/upload',
  GetJoinActivity:DOMAIN+'activityJoin/GetJoinActivity',
  AddLook:DOMAIN+'activity/AddLook',
  GetSignHistory:DOMAIN+'sign/GetSignHistory',
  GetNotice:DOMAIN+'notice/GetNotice',
  addNotice:DOMAIN+'notice/Add',
  AddNoticeLook:DOMAIN+'notice/AddLook',
  getAllClass:DOMAIN+'classes/getAllClass',
  DeleteFile:DOMAIN+'activityStudents/DeleteFile',
  mergeSeparation:DOMAIN+'course/mergeSeparation',//合并被分开的数据 非必要可删
  getAllRole:DOMAIN+'activity/getAllRole',
  //请假接口
  leavePreview:DOMAIN+'leave/preview',//预览请假课程
  leaveNew:DOMAIN+'leave/newLeave',//创建请假申请
  leaveHistory:DOMAIN+'leave/WxGetHistory',//查看请假历史
  leavePic:DOMAIN+'leave/leavePic',
  getFail:DOMAIN+'activity/getFail',
  updateActivity:DOMAIN+'activity/updateActivity',
  
  //课代表修改签到情况
  ChangeSrInfo:DOMAIN+'sign/ChangeSrInfo',
  getDutyCourseInfo:DOMAIN+'sign/getDutyCourseInfo',
  getDutyCourseDetail:DOMAIN+'sign/getDutyCourseDetail',
  getDutyCourseDetail2:DOMAIN+'sign/getDutyCourseDetail2',
  getCourseInfoAdmin:DOMAIN+'sign/getCourseInfoAdmin',
  ChangeSrPic:DOMAIN+'sign/ChangeSrPic',//上传凭证
  editSrInfo:DOMAIN+'sign/editSrInfo',
  //辅导员与学生工作者端
  dailySign:DOMAIN+'sign/WxDailySign',//获取今日课程信息
  judgeLeave:DOMAIN+'leave/WxJudgeLeave',
  judgeLeaveSave:DOMAIN+'leave/WxJudge',
  ExportExcelAll:DOMAIN+'sign/AllExportExcel',
  ExportExcelOne:DOMAIN+'sign/OneExportExcel',
  dailySignDetail:DOMAIN+'sign/dailySignDetail',
  weeklyAbsent:DOMAIN+"sign/GetWeeklyAbsent",//每周缺勤名单
  weeklyAbsentPre:DOMAIN+"sign/GetWeeklyAbsentPre",
  weeklyAbsentExport:DOMAIN+"sign/weeklyAbsentExport",
  CourseAnalysis:DOMAIN+'sign/CourseAnalysis',//课程数据分析
  AnalysisExportStudent:DOMAIN+'sign/AnalysisExportStudent',//课程数据分析
  AnalysisS:DOMAIN+'sign/AnalysisS',
  AnalysisSExport:DOMAIN+'sign/AnalysisSExport',
  //分析并导出学生签到数据
  ExportStudents:DOMAIN+'students/ExportStudents',
  GetStudents:DOMAIN+'students/GetStudents',
  setHoliday:DOMAIN+"sign/setHoliday",
}
export const CURRENT_DOMAIN = DOMAIN; // 当前服务器URL